<script>
	export default {
		onLaunch: function() {
			uni.getSystemInfo({
				success: function(res) {
					if (res.windowWidth > 960) {
						uni.navigateTo({
							url: '/pages/home/mobile?ismobile=true'
						})
					} else {
						var reg = new RegExp("(^|&)" + 'ismobile' + "=([^&]*)(&|$)", "i");
						var r = window.location.search.substr(1).match(reg); 
						if (r != null) {
							let dd = unescape(r[2]);
							if(dd) {
								uni.redirectTo({
									url:'/pages/home/home'
								})
							}
						} 
					}
				}
			});
			console.log('App Launch')
			// #ifdef MP-WEIXIN
			console.log('this wechat');
			const updateManager = uni.getUpdateManager();
			updateManager.onCheckForUpdate(function(res) {
				// 请求完新版本信息的回调
				if (res.hasUpdate) {
					updateManager.onUpdateReady(function(res2) {
						uni.showModal({
							title: '更新提示',
							content: '发现新版本，是否重启应用?',
							cancelColor: '#eeeeee',
							confirmColor: '#FF0000',
							success(res2) {
								if (res2.confirm) {
									// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
									updateManager.applyUpdate();
								}
							}
						});
					});
				}
			}); 
			updateManager.onUpdateFailed(function(res) {
				// 新的版本下载失败
				uni.showModal({
					title: '提示',
					content: '检查到有新版本，但下载失败，请检查网络设置',
					success(res) {
						if (res.confirm) {
							// 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
							updateManager.applyUpdate();
						}
					}
				});
			});

			// #endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	@import "common/common.css";
	@import "@/uni_modules/uview-ui/index.scss";
	/*每个页面公共css */


	.btn {
		padding: 20upx 30upx;
	}

	.btn-yssk {
		background: #09dcd5;
		color: #ffffff;
		border-radius: 14upx;
		font-weight: 500;
		margin-right: 0;
		margin-left: 0;
		font-size: 28upx;
		line-height: 90upx;
	}

	.btn-yssk-rest {
		color: #ffffff;
		background: #09dcd5;
		border-radius: 14upx;
	}

	.btn-yssk-pay {
		padding-left: 60upx;
		padding-right: 60upx;
		background: #09dcd5;
		// background: linear-gradient(90deg, #01d8d1, #34fff8);
		color: #ffffff;
		border-radius: 14upx;
	}

	.btn-card-confrim {
		text-align: center;
		font-size: 28upx;
		font-weight: 500;
	}

	.btn-open {
		background: #01d8d1;
	}

	.btn-close {
		background-color: #feb92e;
	}

	// 通用颜色
	.yssk-color-yellow {
		color: #feb92e !important;
	}

	.yssk-wechat-login {
		color: #ffffff;
		background: #feb92e;
	}

	.yssk-wechat-login:after {
		border: none;
	}

	//无背景按钮
	.btn-nobg {
		text-align: right;
		right: 0upx;
		line-height: 40upx;
		color: #ffffff;
		background: transparent;
		font-size: 28upx;
	}

	.btn-nobg:after {
		border: none;
		background: transparent;
	}

	.user-auth-none {
		background-color: #f3ebe8;
		color: #ff4828;
	}

	.user-auth-over {
		background-color: #09dcd5;
		color: #ffffff;
	}

	// 通用快捷布局
	.yssk-row {
		display: flex;
		flex-direction: row;
	}

	.yssk-row-warp {
		flex-wrap: wrap;
	}

	.yssk-row-space-between {
		justify-content: space-between;
	}

	.yssk-column {
		display: flex;
		flex-direction: column;
	}

	.yssk-row-center {
		display: flex;
		justify-content: center;
	}

	.yssk-row-space-around {
		justify-content: space-around;
	}

	.yssk-row-right {
		display: flex;
		justify-content: right;
	}

	.yssk-icon {
		width: 44upx;
		height: 44upx;
	}

	.yssk-text-center {
		text-align: center;
	}

	.yssk-message {
		margin-top: 60upx;
	}

	//超出隐藏
	.line-limit-length {
		max-width: 460upx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap; //文本不换行，这样超出一行的部分被截取，显示...
	}

	.tk-footer {
		text-align: center;
		padding: 20upx 0;

	}

	/************************************************************
	** 请将全局样式拷贝到项目的全局 CSS 文件或者当前页面的顶部 **
	** 否则页面将无法正常显示                                  **
	************************************************************/

	html {
		font-size: 16px;
	}

	body {
		margin: 0;
		font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
			'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}

	view,
	image,
	text {
		box-sizing: border-box;
		flex-shrink: 0;
	}

	#app {
		width: 100vw;
		height: 100vh;
	}

	.flex-row {
		display: flex;
		flex-direction: row;
	}

	.flex-col {
		display: flex;
		flex-direction: column;
	}

	.justify-start {
		justify-content: flex-start;
	}

	.justify-end {
		justify-content: flex-end;
	}

	.justify-center {
		justify-content: center;
	}

	.justify-between {
		justify-content: space-between;
	}

	.justify-around {
		justify-content: space-around;
	}

	.justify-evenly {
		justify-content: space-evenly;
	}

	.items-start {
		align-items: flex-start;
	}

	.items-end {
		align-items: flex-end;
	}

	.items-center {
		align-items: center;
	}

	.items-baseline {
		align-items: baseline;
	}

	.items-stretch {
		align-items: stretch;
	}

	.self-start {
		align-self: flex-start;
	}

	.self-end {
		align-self: flex-end;
	}

	.self-center {
		align-self: center;
	}

	.self-baseline {
		align-self: baseline;
	}

	.self-stretch {
		align-self: stretch;
	}

	.flex-1 {
		flex: 1 1 0%;
	}

	.flex-auto {
		flex: 1 1 auto;
	}

	.grow {
		flex-grow: 1;
	}

	.grow-0 {
		flex-grow: 0;
	}

	.shrink {
		flex-shrink: 1;
	}

	.shrink-0 {
		flex-shrink: 0;
	}

	.relative {
		position: relative;
	}
</style>